<extend name="Public/base" />

<block name="style" >
    <style>
        .user_table{
            border: 1px solid #ddd;
            width: 180px;
        }
        .user_table tr{
            border: 1px solid #dddddd;
            height: 30px;
        }
        .user_table td{
            border: 1px solid #dddddd;
            width: 90px;
            text-align: center;
        }
    </style>
</block>

<block name="body">
    <!-- 弹窗插件 -->
    <include file="Public:artdialog" />
    <!-- 表单验证插件 -->
    <include file="Public:validform" />

    <form action="{:U('add_refundPost')}" method="post" role="form" class="form-horizontal row-border vform" >

        <input type="hidden" name="id" value="{$entity['id']}">
        <input type="hidden" name="is_add" value="{$is_add}">

        <div class="row">
            <div class="col-md-12">
                <div class="block-web">
                    <div class="header">
                        <h3 class="content-header">退款充值</h3>
                    </div>
                    <div class="porlets-content">

                        <!--<div class="form-group">-->
                            <!--<label class="col-sm-3 control-label"><font class="red">*</font>用户账户</label>-->
                            <!--<div class="col-sm-3">-->
                                <!--<input type="text" value="" name="username" onblur="searchUser(this)" class="form-control " datatype="*" nullmsg="请输入用户账户" />-->
                                <!--<div class="Validform_checktip"></div>-->
                            <!--</div>-->
                        <!--</div>-->



                        <div class="form-group" id="user_info" style="display: none;">
                            <label class="col-sm-3 control-label"></label>
                            <!--<div class="col-sm-6">-->
                                <!--<table class="user_table">-->
                                    <!--<tr>-->
                                        <!--<td>用户昵称</td>-->
                                        <!--<td id="nickname">-</td>-->
                                    <!--</tr>-->
                                    <!--<tr>-->
                                        <!--<td>手机号码</td>-->
                                        <!--<td id="mobile_phone">-</td>-->
                                    <!--</tr>-->
                                    <!--<tr>-->
                                        <!--<td>余额</td>-->
                                        <!--<td id="user_money">-</td>-->
                                    <!--</tr>-->
                                <!--</table>-->
                            <!--</div>-->

                        </div>




                        <div class="form-group">
                            <label class="col-sm-3 control-label"><font class="red">*</font>订单编号</label>
                            <div class="col-sm-3">
                                <input type="text" value="" name="order_number" onblur="search_order_info(this)" class="form-control " datatype="*" nullmsg="请输入订单编号" />
                                <div class="Validform_checktip"></div>
                            </div>
                        </div>



                        <div class="form-group" id="user_order_info" style="display: none;">
                            <label class="col-sm-3 control-label"></label>
                            <div class="col-sm-6">
                                <table class="user_table">
                                    <tr>
                                        <td>订单下单人用户ID</td>
                                        <td id="order_user_id">-</td>
                                    </tr>
                                    <tr>
                                        <td>订单状态</td>
                                        <td id="order_status">-</td>
                                    </tr>
                                    <tr>
                                        <td>订单实际支付金额</td>
                                        <td id="order_rel_money">-</td>
                                    </tr>
                                </table>
                            </div>

                             <div style="clear: both"></div>

                            <label class="col-sm-3 control-label"> </label>
                            <div class="col-sm-6">
                                <table class="user_table">
                                    <tr>
                                        <td>用户昵称</td>
                                        <td id="nickname">-</td>
                                    </tr>
                                    <tr>
                                        <td>手机号码</td>
                                        <td id="mobile_phone">-</td>
                                    </tr>
                                    <tr>
                                        <td>余额</td>
                                        <td id="user_money">-</td>
                                    </tr>
                                </table>
                            </div>



                        </div>



                        <!--<div class="form-group" >-->
                            <!--<label class="col-sm-3 control-label"><font class="red">*</font>出入账</label>-->
                            <!--<div class="col-sm-6">-->
                                <!--<label class="radio-inline">-->
                                    <!--<input type="radio"  name="in_or_out" value="IN">-->
                                    <!--<span class="custom-radio"></span> 进账-->
                                <!--</label>-->
                                <!--<label class="radio-inline">-->
                                    <!--<input type="radio"    name="in_or_out" value="OUT" >-->
                                    <!--<span class="custom-radio"></span> 出账-->
                                <!--</label>-->
                            <!--</div>-->
                        <!--</div>-->
                        <!---->



                        <div class="form-group">
                            <label class="col-sm-3 control-label"><font class="red">*</font>充值金额</label>
                            <div class="col-sm-6">
                                <input type="number" min="0" name="money"  placeholder="请输入充值金额" class="form-control" datatype="*" nullmsg="请输入充值金额" />
                                <div class="Validform_checktip"></div>
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注</label>
                            <div class="col-sm-6" id="activity_rule">
                                <textarea  class="form-control" style="height:80px;" name="remark"></textarea>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label"></label>
                            <button class="btn btn-primary btn-success bt_submit" type="submit" id="submit">提交</button>
                        </div>
                    </div><!--/porlets-content-->
                </div><!--/block-web-->
            </div>

        </div>
        <input type="hidden" name="mobile" id="mobile" value=""/>
        <input type="hidden" name="user_id" id="user_id" value=""/>
    </form>




</block>
<block name="script">
    <script>


        function searchUser(obj) {

            var $username = $(obj).val();

            $.ajax({
                'url': "/indexadmin.php/Payment/search_user",
                'data': {username:$username},
                'dataType': 'json',
                'type': 'POST',
                success: function (data) {
                    if (data.status == 1) {
                        $('#user_info').show();
                        $("#nickname").html(data.a1);
                        $("#mobile_phone").html(data.b);
                        $("#user_money").html(data.c);

                        $("#mobile").val(data.b1);
                        $("#user_id").val(data.a);

                    }

                }, error: function () {
                    /*失败或异常回调*/

                }, complete: function () {

                }
            });


        }


        function search_order_info(obj){


            var $order_number = $(obj).val();

            $.ajax({
                'url': "/indexadmin.php/Payment/search_order_info",
                'data': {order_number:$order_number},
                'dataType': 'json',
                'type': 'POST',
                success: function (data) {
                    if (data.status == 1) {
                        $('#user_order_info').show();

                        $("#order_user_id").html(data.a);
                        $("#order_status").html(data.b);
                        $("#order_rel_money").html(data.c);


                        $("#nickname").html(data.a1);
                        $("#mobile_phone").html(data.b1);
                        $("#user_money").html(data.c1);

                        $("#mobile").val(data.b);
                        $("#user_id").val(data.e);



                        $('#user_info').show();
                        $("#nickname").html(data.a1);
                        $("#mobile_phone").html(data.b1);
                        $("#user_money").html(data.c1);

                        $("#mobile").val(data.b1);
                        $("#user_id").val(data.a);







//                        $("#user_money").html(data.c);
//                        $("#mobile").val(data.b);
//                        $("#user_id").val(data.e);

                    }else if(data.status == 0){

                        showvfmsg(-2,data.info,1000);

                    }

                }, error: function () {
                    /*失败或异常回调*/

                }, complete: function () {

                }
            });





        }




    </script>

</block>
